![]() |
Sensor Fusion for Kinetis MCUs (ISSDK/KSDK version)
|
Include dependency graph for sensor_fusion.c:Go to the source code of this file.
| void addToFifo | ( | FifoSensor * | sensor, |
| uint16_t | maxFifoSize, | ||
| int16_t | sample[3] | ||
| ) |
addToFifo is called from within sensor driver read functions
addToFifo is called from within sensor driver read functions to transfer new readings into the sensor structure corresponding to accel, gyro or mag. This function ensures that the software FIFOs are not overrun.
example usage: if (status==SENSOR_ERROR_NONE) addToFifo((FifoSensor*) &(sfg->Mag), MAG_FIFO_SIZE, sample);
| sensor | pointer to structure of type AccelSensor, MagSensor or GyroSensor |
| maxFifoSize | the size of the software (not hardware) FIFO |
| sample | the sample to add |
Definition at line 531 of file sensor_fusion.c.
Referenced by FXLS8471Q_Read(), FXOS8700_Init(), FXOS8700_ReadMagData(), and MAG3110_Read().
Here is the caller graph for this function:| void clearFIFOs | ( | SensorFusionGlobals * | sfg | ) |
Function to clear FIFO at the end of each fusion computation.
| sfg | Global data structure pointer |
Definition at line 363 of file sensor_fusion.c.
Referenced by initializeFusionEngine(), initSensorFusionGlobals(), and runFusion().
Here is the caller graph for this function:| void conditionSample | ( | int16_t | sample[3] | ) |
conditionSample ensures that we never encounter the maximum negative two's complement value for a 16-bit variable (-32768).
conditionSample ensures that we never encounter the maximum negative two's complement value for a 16-bit variable (-32768). This value cannot be negated, because the maximum positive value is +32767. We need the ability to negate to gaurantee that subsequent HAL operations can be run successfully.
| sample | 16-bit register value from triaxial sensor read |
Definition at line 519 of file sensor_fusion.c.
Referenced by FXLS8471Q_Read(), FXOS8700_Init(), FXOS8700_ReadMagData(), and MAG3110_Read().
Here is the caller graph for this function:| void conditionSensorReadings | ( | SensorFusionGlobals * | sfg | ) |
conditionSensorReadings() transforms raw software FIFO readings into forms that can be consumed by the sensor fusion engine. This include sample averaging and (in the case of the gyro) integrations, applying hardware abstraction layers, and calibration functions. This function is normally involved via the "sfg." global pointer.
| sfg | Global data structure pointer |
Definition at line 305 of file sensor_fusion.c.
Referenced by initSensorFusionGlobals().
Here is the call graph for this function:
Here is the caller graph for this function:| void initializeFusionEngine | ( | SensorFusionGlobals * | sfg | ) |
This function is responsible for initializing the system prior to starting the main fusion loop. This function is normally involved via the "sfg." global pointer.
Definition at line 471 of file sensor_fusion.c.
Referenced by initSensorFusionGlobals().
Here is the call graph for this function:
Here is the caller graph for this function:| int8_t initializeSensors | ( | SensorFusionGlobals * | sfg | ) |
Definition at line 157 of file sensor_fusion.c.
Referenced by initializeFusionEngine().
Here is the call graph for this function:
Here is the caller graph for this function:| void initSensorFusionGlobals | ( | SensorFusionGlobals * | sfg, |
| StatusSubsystem * | pStatusSubsystem, | ||
| ControlSubsystem * | pControlSubsystem | ||
| ) |
utility function to insert default values in the top level structure
| sfg | Global data structure pointer |
| pStatusSubsystem | Status subsystem pointer |
| pControlSubsystem | Control subsystem pointer |
Definition at line 68 of file sensor_fusion.c.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| int8_t installSensor | ( | SensorFusionGlobals * | sfg, |
| PhysicalSensor * | pSensor, | ||
| uint16_t | addr, | ||
| uint16_t | schedule, | ||
| void * | bus_driver, | ||
| initializeSensor_t * | initialize, | ||
| readSensor_t * | read | ||
| ) |
installSensor is used to instantiate a physical sensor driver into the sensor fusion system. This function is normally involved via the "sfg." global pointer.
| sfg | top level fusion structure |
| pSensor | pointer to structure describing physical sensor |
| addr | I2C address for sensor (if applicable) |
| schedule | Parameter to control sensor sampling rate |
| bus_driver | ISSDK sensor bus driver (usually KSDK I2C bus) |
| initialize | pointer to sensor initialization function |
| read | pointer to sensor read function |
Definition at line 122 of file sensor_fusion.c.
Referenced by initSensorFusionGlobals().
Here is the caller graph for this function:| void processMagData | ( | SensorFusionGlobals * | sfg | ) |
Definition at line 209 of file sensor_fusion.c.
Referenced by conditionSensorReadings().
Here is the call graph for this function:
Here is the caller graph for this function:| void queueStatus | ( | SensorFusionGlobals * | sfg, |
| fusion_status_t | status | ||
| ) |
Poor man's inheritance for status subsystem queueStatus command. This function is normally involved via the "sfg." global pointer.
Definition at line 50 of file sensor_fusion.c.
Referenced by initSensorFusionGlobals().
Here is the caller graph for this function:| int8_t readSensors | ( | SensorFusionGlobals * | sfg, |
| uint16_t | read_loop_counter | ||
| ) |
readSensors traverses the linked list of physical sensors, calling the individual read functions one by one. This function is normally involved via the "sfg." global pointer.
| sfg | pointer to global sensor fusion data structure |
| read_loop_counter | current loop counter (used for multirate processing) |
Definition at line 276 of file sensor_fusion.c.
Referenced by initSensorFusionGlobals().
Here is the caller graph for this function:| void runFusion | ( | SensorFusionGlobals * | sfg | ) |
runFusion the top level call that actually runs the sensor fusion. This is a utility function which manages the various defines in build.h. You should feel free to drop down a level and implement only those portions of fFuseSensors() that your application needs. This function is normally involved via the "sfg." global pointer.
Definition at line 386 of file sensor_fusion.c.
Referenced by initSensorFusionGlobals().
Here is the call graph for this function:
Here is the caller graph for this function:| void setStatus | ( | SensorFusionGlobals * | sfg, |
| fusion_status_t | status | ||
| ) |
Poor man's inheritance for status subsystem setStatus command This function is normally involved via the "sfg." global pointer.
Definition at line 43 of file sensor_fusion.c.
Referenced by initSensorFusionGlobals().
Here is the caller graph for this function:| void testStatus | ( | SensorFusionGlobals * | sfg | ) |
Definition at line 62 of file sensor_fusion.c.
Referenced by initSensorFusionGlobals().
Here is the caller graph for this function:| void updateStatus | ( | SensorFusionGlobals * | sfg | ) |
Poor man's inheritance for status subsystem updateStatus command. This function is normally involved via the "sfg." global pointer.
Definition at line 57 of file sensor_fusion.c.
Referenced by initSensorFusionGlobals().
Here is the caller graph for this function:| void zeroArray | ( | StatusSubsystem * | pStatus, |
| void * | data, | ||
| uint16_t | size, | ||
| uint16_t | numElements, | ||
| uint8_t | check | ||
| ) |
| pStatus | Status subsystem pointer |
| data | pointer to array to be zeroed |
| size | data type size = 8, 16 or 32 |
| numElements | number of elements to zero out |
| check | true if you would like to verify writes, false otherwise |
Definition at line 320 of file sensor_fusion.c.